<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/jsp/common/inc.jsp"%>
<title>营业数据查询</title>
<script type="text/javascript">
	var datagrid1;
	$(function() {
		datagrid1 = $("#grid1").datagrid({
			url : "${pageContext.request.contextPath}/report/datagrid",
			striped : true,
			rownumbers : true,
			pagination : true,
			singleSelect : true,
			fitColumns : true,
			idField : "id",
			pagesize : 10,
			pageList : [ 10, 20, 30 ],
			toolbar : "#toolbar1",
			columns : [ [ {
				width : 100,
				title : "分店",
				field : "branch",
				formatter : function(value, rowData, rowIndex) {
					return value.branchName;
				}
			}, {
				width : 100,
				title : "日期",
				field : "tCreatedate",
				formatter : function(value, rowData, rowIndex) {
					return value.substr(0, 10);
				}
			},{
				width : 100,
				title : "上传时间",
				field : "tLinshi",
				formatter : function(value, rowData, rowIndex) {
					if(value == "1"){
						return "中午";
					}
					return "晚上";
				}
			}, {
				width : 100,
				title : "销售总额",
				field : "tXsjeTotal"
			}, {
				width : 100,
				title : "折扣总额",
				field : "tXszk"
			}, {
				width : 100,
				title : "券不找零",
				field : "tNochange"
			}, {
				width : 100,
				title : "券不打折",
				field : "tNopay"
			}, {
				width : 100,
				title : "客人数",
				field : "tPaxNum"
			}, {
				width : 100,
				title : "账单数",
				field : "tBillNum"
			},{
				width : 100,
				title : "翻台率",
				field : "tFantailv"
			},{
				width : 100,
				title : "纯销售金额",
				field : "tCxsje"
			},{
				width : 100,
				title : "现金收入",
				field : "tXj"
			},{
				width : 100,
				title : "微信",
				field : "tXyk"
			},{
				width : 100,
				title : "雅酷",
				field : "tZp"
			},{
				width : 100,
				title : "餐券",
				field : "tGwq"
			},{
				width : 100,
				title : "储值卡",
				field : "tHyk"
			},{
				width : 100,
				title : "团购",
				field : "tPay04"
			} ] ]
		});

	});
	
	var datagrid2;
	$(function() {
		datagrid2 = $("#grid2").datagrid({
			url : "${pageContext.request.contextPath}/report/datagrid",
			striped : true,
			rownumbers : true,
			pagination : true,
			singleSelect : true,
			fitColumns : true,
			idField : "id",
			pagesize : 10,
			pageList : [ 10, 20, 30 ],
			toolbar : "#toolbar2",
			columns : [ [ {
				width : 100,
				title : "分店",
				field : "branch",
				formatter : function(value, rowData, rowIndex) {
					return value.branchName;
				}
			}, {
				width : 100,
				title : "日期",
				field : "tCreatedate",
				formatter : function(value, rowData, rowIndex) {
					return value.substr(0, 10);
				}
			}, {
				width : 100,
				title : "上传时间",
				field : "tLinshi",
				formatter : function(value, rowData, rowIndex) {
					if(value == "1"){
						return "中午";
					}
					return "晚上";
				}
			},{
				width : 100,
				title : "销售总额",
				field : "tXsjeTotal"
			}, {
				width : 100,
				title : "折扣总额",
				field : "tXszk"
			}, {
				width : 100,
				title : "券不找零",
				field : "tNochange"
			}, {
				width : 100,
				title : "券不打折",
				field : "tNopay"
			}, {
				width : 100,
				title : "客人数",
				field : "tPaxNum"
			}, {
				width : 100,
				title : "账单数",
				field : "tBillNum"
			},{
				width : 100,
				title : "翻台率",
				field : "tFantailv"
			},{
				width : 100,
				title : "纯销售金额",
				field : "tCxsje"
			},{
				width : 100,
				title : "现金收入",
				field : "tXj"
			},{
				width : 100,
				title : "微信",
				field : "tXyk"
			},{
				width : 100,
				title : "雅酷",
				field : "tZp"
			},{
				width : 100,
				title : "餐券",
				field : "tGwq"
			},{
				width : 100,
				title : "储值卡",
				field : "tHyk"
			},{
				width : 100,
				title : "团购",
				field : "tPay04"
			} ] ]
		});
	});
	
	//查询条件
	$(function(){
		// 初始化日期控件
		$("#createDateStr1").datebox();
		$("#createDateStr2").datebox();
		
		var today = "${today}";
		$("#createDateStr1").datebox("setValue",today);
		$("#createDateStr2").datebox("setValue",today);
		
		// 初始化分店信息
		$("#tId1").combobox({
			url : "${pageContext.request.contextPath}/commonController/branchList",
			valueField : 'id',
			textField : 'branchName',
			width : 100,
		});
		// 初始化分店信息
		$("#tId2").combobox({
			url : "${pageContext.request.contextPath}/commonController/branchList",
			valueField : 'id',
			textField : 'branchName',
			width : 100,
		});
	});
	
	function searchFun1() {
		var params = sy.serializeObject($("#search_form1"));
		datagrid1.datagrid("load", params);
	}
	
	function searchFun2() {
		var params = sy.serializeObject($("#search_form2"));
		console.info(params);
		datagrid2.datagrid("load", params);
	}
	
	function clearFun1() {
		$("#search_form1").find("input").val("");
		datagrid1.datagrid("load", {});
	}
	
	function clearFun2() {
		$("#search_form2").find("input").val("");
		datagrid1.datagrid("load", {});
	}
</script>
</head>
<body>

	<div id="toolbar1" style="display: none;">
		<form id="search_form1">
			<table>
				<tr>
					<td>创建日期</td>
					<td><input id="createDateStr1" name="createDateStr" /></td>
					<td>分店</td>
					<td><input id="tId1" name="tId" /></td>
				</tr>
				<tr>
				    <td>数据上传时间</td>
					<td>
						<select class="easyui-combobox" id="tLinshi1" name="tLinshi" style="width:155px;" >
							<option value="">请选择</option>
							<option value="0">中午</option>
							<option value="1">晚上</option>
						</select>
					</td>
					<td></td><td></td>
					<td>
						<a href="#" class="easyui-linkbutton"
						onclick="searchFun1()">查询</a>
					</td>
					<td>
						<a href="#" class="easyui-linkbutton" onclick="clearFun()">清空</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
	
	<div id="toolbar2" style="display: none;">
		<form id="search_form2">
			<table>
				<tr>
					<td>创建日期</td>
					<td><input id="createDateStr2" name="createDateStr" /></td>
					<td>分店</td>
					<td><input id="tId2" name="tId" /></td>
				</tr>
				<tr>
				    <td>数据上传时间</td>
					<td>
						<select class="easyui-combobox" id="tLinshi" name="tLinshi" style="width:155px;" >
							<option value="">请选择</option>
							<option value="0">中午</option>
							<option value="1">晚上</option>
						</select>
					</td>
					<td></td><td></td>
					<td>
						<a href="#" class="easyui-linkbutton"
						onclick="searchFun2()">查询</a>
					</td>
					<td>
						<a href="#" class="easyui-linkbutton" onclick="clearFun()">清空</a>
					</td>
				</tr>
			</table>
		</form>
	</div>

	<div  class="easyui-layout" data-options="fit:true,border:false">
		<div data-options="region:'center'" style="height: 50%">
			<table id="grid1" data-options="fit:true,border:false"></table>
		</div>
		
		<div data-options="region:'south'" style="height: 50%">
		    <table id="grid2" data-options="fit:true,border:false"></table>
		</div>
	</div>
	
</body>
</html>